#!/usr/bin/python

import getopt, sys
import wowget

# All possible options
optionsString = 'h:'

if __name__ == "__main__":
    # Make the container class
    WoWGet = wowget.WoWGet()
    try:
        opts, args = getopt.getopt(sys.argv[1:], optionsString)
    except getopt.GetoptError:
        WoWGet.help()
        sys.exit(2)
    
    for o, a in opts:
        if o == "-h":
            WoWGet.help(a) # one 
            sys.exit()
    if not args:
        WoWGet.help() # two
    elif args[0] == 'help':
        if args[1]:
            WoWGet.help(sys.args[1]) # three
        else:
            WoWGet.help() # four
    elif args[0] == 'update':
        WoWGet.update()
    elif args[0] == 'upgrade':
        WoWGet.upgrade()
    elif args[0] == 'list':
        WoWGet.list()
    elif args[0] == 'detail':
        WoWGet.detail(args[1:])
    elif args[0] == 'install':
        WoWGet.install(args[1:])
    elif args[0] == 'remove':
	WoWGet.remove(args[1:])
    elif args[0] == 'expand':
        WoWGet.expand(args[1])
    elif args[0] == 'installed':
        WoWGet.config.installed.list()
    elif args[0] == 'versions':
        WoWGet.config.installed.list('Version')
    else:
        WoWGet.help() # five
